package com.yunji.system.service.engine;

import com.yunji.common.constant.LogicCode;
import com.yunji.common.model.domain.CaptchaPicsDO;
import com.yunji.common.utils.bean.BeanUtils;
import com.yunji.system.service.CaptchaPicsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.common.engine
 * @Title: CaptchaPicsValidate
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-11-19 17:16:45      V1.0        HuaAo       新建类
 */
@Component
public class CaptchaPicsValidate {

    @Autowired
    private CaptchaPicsService captchaPicsService;

    public boolean checkUpdate(CaptchaPicsDO info, CaptchaPicsDO captchaPicsDO) {
        boolean result;
        result = BeanUtils.equals(LogicCode.NO, info.getStatus(), captchaPicsDO.getStatus()) ? Boolean.TRUE : Boolean.FALSE;
        return result;
    }

    public boolean checkDelete() {
        CaptchaPicsDO param = new CaptchaPicsDO();
        param.setStatus(LogicCode.NO);
        List<CaptchaPicsDO> list = captchaPicsService.search(param);
        return list.size() > 1;

    }

}